package emulator.hardware.io.peripherals.iec;

public class IecSimDeviceFactory {

	public IecSimDevice createDevice(DeviceInfo deviceInfo)
	{
		if (deviceInfo.isEnabled())
		{
			if (deviceInfo.getType().equalsIgnoreCase(DeviceInfo.getDeviceTypes()[DeviceInfo.PRINTER]))
			{
				if (deviceInfo.getFile().isEmpty() || deviceInfo.getFile().equalsIgnoreCase("(null)"))
					return new IecSimNullPrinter();
				else
					return new IecSimFilePrinter(deviceInfo.getFile());
			}
			if (deviceInfo.getType().equalsIgnoreCase(DeviceInfo.getDeviceTypes()[DeviceInfo.DISK]))
				return new IecSimFsDriver(deviceInfo.getFile());
		}
		return null;
	}

}
